Component({
	externalClasses: ['wr-sold-out', 'wr-class'],

	options: { multipleSlots: true },

	properties: {
		soldout: {
			// 商品是否下架
			type: Boolean,
			value: false,
		},
		jumpArray: {
			type: Array,
			value: [],
		},
		isStock: {
			type: Boolean,
			value: true,
		}, // 是否有库存
		isSlotButton: {
			type: Boolean,
			value: false,
		}, // 是否开启按钮插槽
		shopCartNum: {
			type: Number, // 购物车气泡数量
		},
		buttonType: {
			type: Number,
			value: 0,
		},
		minDiscountPrice: {
			type: String,
			value: '',
		},
		minSalePrice: {
			type: String,
			value: '',
		},
	},

	data: {
		fillPrice: false,
	},

	methods: {
		//加入购物车
		toAddCart() {
			const { isStock } = this.properties;
			if (!isStock) return;
			this.triggerEvent('toAddCart');
		},
		//立即购买
		toBuyNow(e) {
			const { isStock } = this.properties;
			if (!isStock) return;
			this.triggerEvent('toBuyNow', e);
		},
		//首页 购物车 返回事件
		toNav(e) {
			const { url } = e.currentTarget.dataset;
			return this.triggerEvent('toNav', {
				e,
				url,
			});
		},
	},
});
